<?php
namespace Home\Controller;

use Common\Controller\UserBaseController;

/**
 * 首页控制器
 */
class OddsController extends UserBaseController
{

    /**
     *
     */
    public function index()
    {
        $c_type  = $_GET['lottery'];
        $games   = $_GET['games'];
        $n_games = explode(",", $games);
        $count   = count($n_games);
        $pan     = M('member')->where('member_id=' . $_SESSION['member_id'])->getField('pan');

        //print_r($count);exit;
        $data = array();
        switch ($c_type) {
            //幸运飞艇
            case 'XYFT': //幸运飞艇 彩种id 5
                header('Content-type:text/json');
                for ($i = 1; $i <= 11; $i++) {
                    $odds[$i] = S($pan . '_odds_5_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 5;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_5_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 3) {
                    //冠亚军组合
                    for ($j = 1; $j <= 17; $j++) {
                        $b                 = $j + 2;
                        $data['GYH_' . $b] = $odds[1][$j]; //1-10名 的赔率
                    }
                    $data['GDS_D'] = $odds[1][20];
                    $data['GDS_S'] = $odds[1][21];
                    $data['GDX_D'] = $odds[1][18];
                    $data['GDX_X'] = $odds[1][19];

                } else if ($count == 10) {
                    //单号1-10
                    for ($j = 1; $j <= 10; $j++) {
                        $a = $j + 1;
                        for ($k = 1; $k <= 10; $k++) {
                            if ($j <= 5) {
                                $b = $k + 6;
                            } else {
                                $b = $k + 4;
                            }
                            $data['B' . $j . '_' . $k] = $odds[$a][$b]; //1-10名 的赔率
                        }
                    }

                } else {
                    //两面  DX1,DX2,DX3,DX4,DX5,DX6,DX7,DX8,DX9,DX10,DS1,DS2,DS3,DS4,DS5,DS6,DS7,DS8,DS9,DS10,GDX,GDS,LH1,LH2,LH3,LH4,LH5
                    for ($j = 1; $j <= 10; $j++) {
                        $a                      = $j + 1;
                        $data['DX' . $j . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $j . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $j . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $j . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        if ($j <= 5) {
                            $data['LH' . $j . '_L'] = $odds[$a][5]; //1-5名龙的赔率
                            $data['LH' . $j . '_H'] = $odds[$a][6]; //1-5名虎的赔率
                        }
                    }
                    $data['GDS_D'] = $odds[1][20];
                    $data['GDS_S'] = $odds[1][21];
                    $data['GDX_D'] = $odds[1][18];
                    $data['GDX_X'] = $odds[1][19];

                }
                //echo $_GET['callback']."(".json_encode($data).")";    exit(0);
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //北京PK10
            case 'BJPK10': //北京PK10 彩种id  4
                header('Content-type:text/json');
                for ($i = 1; $i <= 11; $i++) {
                    $odds[$i] = S($pan . '_odds_4_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 4;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_4_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 3) {
                    //冠亚军组合
                    for ($j = 1; $j <= 17; $j++) {
                        $b                 = $j + 2;
                        $data['GYH_' . $b] = $odds[1][$j]; //1-10名 的赔率
                    }
                    $data['GDS_D'] = $odds[1][20];
                    $data['GDS_S'] = $odds[1][21];
                    $data['GDX_D'] = $odds[1][18];
                    $data['GDX_X'] = $odds[1][19];

                } else if ($count == 10) {
                    //单号1-10
                    for ($j = 1; $j <= 10; $j++) {
                        $a = $j + 1;
                        for ($k = 1; $k <= 10; $k++) {

                            if ($j <= 5) {
                                $b = $k + 6;
                            } else {
                                $b = $k + 4;
                            }

                            $data['B' . $j . '_' . $k] = $odds[$a][$b]; //1-10名 的赔率
                        }
                    }

                } else {
                    //两面  DX1,DX2,DX3,DX4,DX5,DX6,DX7,DX8,DX9,DX10,DS1,DS2,DS3,DS4,DS5,DS6,DS7,DS8,DS9,DS10,GDX,GDS,LH1,LH2,LH3,LH4,LH5
                    for ($j = 1; $j <= 10; $j++) {
                        $a                      = $j + 1;
                        $data['DX' . $j . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $j . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $j . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $j . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        if ($j <= 5) {
                            $data['LH' . $j . '_L'] = $odds[$a][5]; //1-5名龙的赔率
                            $data['LH' . $j . '_H'] = $odds[$a][6]; //1-5名虎的赔率
                        }
                    }
                    $data['GDS_D'] = $odds[1][20];
                    $data['GDS_S'] = $odds[1][21];
                    $data['GDX_D'] = $odds[1][18];
                    $data['GDX_X'] = $odds[1][19];

                }
                //  print_r($data);exit;
                //echo $_GET['callback']."(".json_encode($data).")";    exit(0);
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //重庆时时彩
            case 'CQSSC': //重庆时时彩 彩种id 1
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_1_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 1;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_1_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //新疆时时彩
            case 'XJSSC': //新疆时时彩 彩种id 2
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_2_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 2;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_2_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //新疆时时彩
            case 'TJSSC': //新疆时时彩 彩种id 2
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_3_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 3;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_3_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //重庆幸运农场
            case 'XYNC': //重庆幸运农场 彩种id 8
                header('Content-type:text/json');
                for ($i = 1; $i <= 11; $i++) {
                    $odds[$i] = S($pan . '_odds_8_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 8;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_8_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 39) {
                    //两面盘
                    $data['ZDS_D']  = $odds[1][3];
                    $data['ZDS_S']  = $odds[1][4];
                    $data['ZDX_D']  = $odds[1][1];
                    $data['ZDX_X']  = $odds[1][2];
                    $data['ZWDX_D'] = $odds[1][5];
                    $data['ZWDX_X'] = $odds[1][6];
                    for ($j = 1; $j <= 8; $j++) {
                        $a                       = $j + 1;
                        $data['DX' . $j . '_D']  = $odds[$a][21];
                        $data['DX' . $j . '_X']  = $odds[$a][22];
                        $data['DS' . $j . '_D']  = $odds[$a][23];
                        $data['DS' . $j . '_S']  = $odds[$a][24];
                        $data['WDX' . $j . '_D'] = $odds[$a][25];
                        $data['WDX' . $j . '_X'] = $odds[$a][26];
                        $data['HDS' . $j . '_D'] = $odds[$a][27];
                        $data['HDS' . $j . '_S'] = $odds[$a][28];
                        if ($j <= 4) {
                            $data['LH' . $j . '_L'] = $odds[$a][36];
                            $data['LH' . $j . '_H'] = $odds[$a][37];
                        }
                    }
                } else if ($games == 'B1,B2,B3,B4,B5,B6,B7,B8') {
                    //单球1-8
                    for ($j = 1; $j <= 8; $j++) {
                        for ($k = 1; $k <= 20; $k++) {
                            $a = $j + 1;
                            if ($k < 10) {
                                $data['B' . $j . '_0' . $k] = $odds[$a][$k];
                            } else {
                                $data['B' . $j . '_' . $k] = $odds[$a][$k];
                            }
                        }
                    }
                } else if ($games == 'LM2,LM3,LM4,LM5,LM21,LM22,LM31,LM32') {
                    //连码
                    $data['LM2_0']  = $odds[11][1];
                    $data['LM22_0'] = $odds[11][2];
                    $data['LM3_0']  = $odds[11][3];
                    $data['LM32_0'] = $odds[11][4];
                    $data['LM4_0']  = $odds[11][5];
                    $data['LM5_0']  = $odds[11][6];

                } else if ($count == 5) {
                    //正码
                    $data['ZDS_D']  = $odds[1][3];
                    $data['ZDS_S']  = $odds[1][4];
                    $data['ZDX_D']  = $odds[1][1];
                    $data['ZDX_X']  = $odds[1][2];
                    $data['ZWDX_D'] = $odds[1][5];
                    $data['ZWDX_X'] = $odds[1][6];
                    for ($j = 1; $j <= 20; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[10][$j];
                        } else {
                            $data['ZM_' . $j] = $odds[10][$j];
                        }
                    }
                } else {
                    //1-8号球
                    $a = $_SESSION['index'];

                    $b = $a + 1;
                    for ($j = 1; $j <= 20; $j++) {
                        if ($j < 10) {
                            $data['B' . $a . '_0' . $j] = $odds[$b][$j];
                        } else {
                            $data['B' . $a . '_' . $j] = $odds[$b][$j];
                        }
                    }
                    $data['DX' . $a . '_D'] = $odds[$b][21];
                    $data['DX' . $a . '_X'] = $odds[$b][22];
                    $data['DS' . $a . '_D'] = $odds[$b][23];
                    $data['DS' . $a . '_S'] = $odds[$b][24];

                    $data['WDX' . $a . '_D'] = $odds[$b][25];
                    $data['WDX' . $a . '_X'] = $odds[$b][26];
                    $data['HDS' . $a . '_D'] = $odds[$b][27];
                    $data['HDS' . $a . '_S'] = $odds[$b][28];

                    $data['FW' . $a . '_0'] = $odds[$b][29]; //东
                    $data['FW' . $a . '_1'] = $odds[$b][31]; //南
                    $data['FW' . $a . '_2'] = $odds[$b][30]; //西
                    $data['FW' . $a . '_3'] = $odds[$b][32]; //北

                    $data['ZFB' . $a . '_0'] = $odds[$b][33]; //中
                    $data['ZFB' . $a . '_1'] = $odds[$b][34]; //发
                    $data['ZFB' . $a . '_2'] = $odds[$b][35]; //白

                    if ($a < 5) {
                        $data['LH' . $a . '_L'] = $odds[$b][36]; //龙
                        $data['LH' . $a . '_H'] = $odds[$b][37]; //虎
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //广东快乐十分
            case 'GDKLSF': //广东快乐十分 彩种id 6
                header('Content-type:text/json');
                for ($i = 1; $i <= 11; $i++) {
                    $odds[$i] = S($pan . '_odds_6_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 6;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_6_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 39) {
                    //两面盘
                    $data['ZDS_D']  = $odds[1][3];
                    $data['ZDS_S']  = $odds[1][4];
                    $data['ZDX_D']  = $odds[1][1];
                    $data['ZDX_X']  = $odds[1][2];
                    $data['ZWDX_D'] = $odds[1][5];
                    $data['ZWDX_X'] = $odds[1][6];
                    for ($j = 1; $j <= 8; $j++) {
                        $a                       = $j + 1;
                        $data['DX' . $j . '_D']  = $odds[$a][21];
                        $data['DX' . $j . '_X']  = $odds[$a][22];
                        $data['DS' . $j . '_D']  = $odds[$a][23];
                        $data['DS' . $j . '_S']  = $odds[$a][24];
                        $data['WDX' . $j . '_D'] = $odds[$a][25];
                        $data['WDX' . $j . '_X'] = $odds[$a][26];
                        $data['HDS' . $j . '_D'] = $odds[$a][27];
                        $data['HDS' . $j . '_S'] = $odds[$a][28];
                        if ($j <= 4) {
                            $data['LH' . $j . '_L'] = $odds[$a][36];
                            $data['LH' . $j . '_H'] = $odds[$a][37];
                        }
                    }
                } else if ($games == 'B1,B2,B3,B4,B5,B6,B7,B8') {
                    //单球1-8
                    for ($j = 1; $j <= 8; $j++) {
                        for ($k = 1; $k <= 20; $k++) {
                            $a = $j + 1;
                            if ($k < 10) {
                                $data['B' . $j . '_0' . $k] = $odds[$a][$k];
                            } else {
                                $data['B' . $j . '_' . $k] = $odds[$a][$k];
                            }
                        }
                    }
                } else if ($games == 'LM2,LM3,LM4,LM5,LM21,LM22,LM31,LM32') {
                    //连码
                    $data['LM2_0']  = $odds[11][1];
                    $data['LM22_0'] = $odds[11][2];
                    $data['LM3_0']  = $odds[11][3];
                    $data['LM32_0'] = $odds[11][4];
                    $data['LM4_0']  = $odds[11][5];
                    $data['LM5_0']  = $odds[11][6];

                } else if ($count == 5) {
                    //正码
                    $data['ZDS_D']  = $odds[1][3];
                    $data['ZDS_S']  = $odds[1][4];
                    $data['ZDX_D']  = $odds[1][1];
                    $data['ZDX_X']  = $odds[1][2];
                    $data['ZWDX_D'] = $odds[1][5];
                    $data['ZWDX_X'] = $odds[1][6];
                    for ($j = 1; $j <= 20; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[10][$j];
                        } else {
                            $data['ZM_' . $j] = $odds[10][$j];
                        }
                    }
                } else {
                    //1-8号球
                    $a = $_SESSION['index'];

                    $b = $a + 1;
                    for ($j = 1; $j <= 20; $j++) {
                        if ($j < 10) {
                            $data['B' . $a . '_0' . $j] = $odds[$b][$j];
                        } else {
                            $data['B' . $a . '_' . $j] = $odds[$b][$j];
                        }
                    }
                    $data['DX' . $a . '_D'] = $odds[$b][21];
                    $data['DX' . $a . '_X'] = $odds[$b][22];
                    $data['DS' . $a . '_D'] = $odds[$b][23];
                    $data['DS' . $a . '_S'] = $odds[$b][24];

                    $data['WDX' . $a . '_D'] = $odds[$b][25];
                    $data['WDX' . $a . '_X'] = $odds[$b][26];
                    $data['HDS' . $a . '_D'] = $odds[$b][27];
                    $data['HDS' . $a . '_S'] = $odds[$b][28];

                    $data['FW' . $a . '_0'] = $odds[$b][29]; //东
                    $data['FW' . $a . '_1'] = $odds[$b][31]; //南
                    $data['FW' . $a . '_2'] = $odds[$b][30]; //西
                    $data['FW' . $a . '_3'] = $odds[$b][32]; //北

                    $data['ZFB' . $a . '_0'] = $odds[$b][33]; //中
                    $data['ZFB' . $a . '_1'] = $odds[$b][34]; //发
                    $data['ZFB' . $a . '_2'] = $odds[$b][35]; //白

                    if ($a < 5) {
                        $data['LH' . $a . '_L'] = $odds[$b][36]; //龙
                        $data['LH' . $a . '_H'] = $odds[$b][37]; //虎
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //广西快三
            case 'GXK3': //广西快三 彩种id 7
                header('Content-type:text/json');
                for ($i = 1; $i <= 6; $i++) {
                    $odds[$i] = S($pan . '_odds_7_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 7;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_7_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($games) {
                    //鱼虾蟹骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j] = $odds[6][$j]; //三军
                    }
                } else {
                    //大小骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j]           = $odds[1][$j]; //三军
                        $data['WS_' . $j . $j . $j] = $odds[2][$j]; //围骰
                        $data['DP_' . $j . $j]      = $odds[5][$j]; //短牌
                        if ($j <= 5) {
                            $d                 = $j + 1;
                            $data['CP_1' . $d] = $odds[4][$j]; //长牌
                        }
                        if ($j <= 4) {
                            $c                 = $j + 5;
                            $e                 = $j + 2;
                            $data['CP_2' . $e] = $odds[4][$c]; //长牌
                        }
                    }
                    $data['CP_34'] = $odds[4][10]; //长牌
                    $data['CP_35'] = $odds[4][11]; //长牌
                    $data['CP_36'] = $odds[4][12]; //长牌
                    $data['CP_45'] = $odds[4][13]; //长牌
                    $data['CP_46'] = $odds[4][14]; //长牌
                    $data['CP_56'] = $odds[4][15]; //长牌

                    $data['DX_D'] = $odds[1][7]; //大小
                    $data['DX_X'] = $odds[1][8]; //大小
                    $data['QS_0'] = $odds[2][7]; //全骰
                    for ($k = 1; $k <= 14; $k++) {
                        $a                = $k + 3;
                        $data['DS_' . $a] = $odds[3][$j]; //点数
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //河北快三
            case 'HEBK3': //河北快三 彩种id 18
                header('Content-type:text/json');
                for ($i = 1; $i <= 6; $i++) {
                    $odds[$i] = S($pan . '_odds_18_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 18;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_18_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($games) {
                    //鱼虾蟹骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j] = $odds[6][$j]; //三军
                    }
                } else {
                    //大小骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j]           = $odds[1][$j]; //三军
                        $data['WS_' . $j . $j . $j] = $odds[2][$j]; //围骰
                        $data['DP_' . $j . $j]      = $odds[5][$j]; //短牌
                        if ($j <= 5) {
                            $d                 = $j + 1;
                            $data['CP_1' . $d] = $odds[4][$j]; //长牌
                        }
                        if ($j <= 4) {
                            $c                 = $j + 5;
                            $e                 = $j + 2;
                            $data['CP_2' . $e] = $odds[4][$c]; //长牌
                        }
                    }
                    $data['CP_34'] = $odds[4][10]; //长牌
                    $data['CP_35'] = $odds[4][11]; //长牌
                    $data['CP_36'] = $odds[4][12]; //长牌
                    $data['CP_45'] = $odds[4][13]; //长牌
                    $data['CP_46'] = $odds[4][14]; //长牌
                    $data['CP_56'] = $odds[4][15]; //长牌

                    $data['DX_D'] = $odds[1][7]; //大小
                    $data['DX_X'] = $odds[1][8]; //大小
                    $data['QS_0'] = $odds[2][7]; //全骰
                    for ($k = 1; $k <= 14; $k++) {
                        $a                = $k + 3;
                        $data['DS_' . $a] = $odds[3][$j]; //点数
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //湖北快三
            case 'HUBK3': //湖北快三 彩种id 19
                header('Content-type:text/json');
                for ($i = 1; $i <= 6; $i++) {
                    $odds[$i] = S($pan . '_odds_19_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 19;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_19_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($games) {
                    //鱼虾蟹骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j] = $odds[6][$j]; //三军
                    }
                } else {
                    //大小骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j]           = $odds[1][$j]; //三军
                        $data['WS_' . $j . $j . $j] = $odds[2][$j]; //围骰
                        $data['DP_' . $j . $j]      = $odds[5][$j]; //短牌
                        if ($j <= 5) {
                            $d                 = $j + 1;
                            $data['CP_1' . $d] = $odds[4][$j]; //长牌
                        }
                        if ($j <= 4) {
                            $c                 = $j + 5;
                            $e                 = $j + 2;
                            $data['CP_2' . $e] = $odds[4][$c]; //长牌
                        }
                    }
                    $data['CP_34'] = $odds[4][10]; //长牌
                    $data['CP_35'] = $odds[4][11]; //长牌
                    $data['CP_36'] = $odds[4][12]; //长牌
                    $data['CP_45'] = $odds[4][13]; //长牌
                    $data['CP_46'] = $odds[4][14]; //长牌
                    $data['CP_56'] = $odds[4][15]; //长牌

                    $data['DX_D'] = $odds[1][7]; //大小
                    $data['DX_X'] = $odds[1][8]; //大小
                    $data['QS_0'] = $odds[2][7]; //全骰
                    for ($k = 1; $k <= 14; $k++) {
                        $a                = $k + 3;
                        $data['DS_' . $a] = $odds[3][$j]; //点数
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //江苏快三
            case 'JSK3': //江苏快三 彩种id 20
                header('Content-type:text/json');
                for ($i = 1; $i <= 6; $i++) {
                    $odds[$i] = S($pan . '_odds_20_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 20;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_20_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($games) {
                    //鱼虾蟹骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j] = $odds[6][$j]; //三军
                    }
                } else {
                    //大小骰宝
                    for ($j = 1; $j <= 6; $j++) {
                        $data['3G_' . $j]           = $odds[1][$j]; //三军
                        $data['WS_' . $j . $j . $j] = $odds[2][$j]; //围骰
                        $data['DP_' . $j . $j]      = $odds[5][$j]; //短牌
                        if ($j <= 5) {
                            $d                 = $j + 1;
                            $data['CP_1' . $d] = $odds[4][$j]; //长牌
                        }
                        if ($j <= 4) {
                            $c                 = $j + 5;
                            $e                 = $j + 2;
                            $data['CP_2' . $e] = $odds[4][$c]; //长牌
                        }
                    }
                    $data['CP_34'] = $odds[4][10]; //长牌
                    $data['CP_35'] = $odds[4][11]; //长牌
                    $data['CP_36'] = $odds[4][12]; //长牌
                    $data['CP_45'] = $odds[4][13]; //长牌
                    $data['CP_46'] = $odds[4][14]; //长牌
                    $data['CP_56'] = $odds[4][15]; //长牌

                    $data['DX_D'] = $odds[1][7]; //大小
                    $data['DX_X'] = $odds[1][8]; //大小
                    $data['QS_0'] = $odds[2][7]; //全骰
                    for ($k = 1; $k <= 14; $k++) {
                        $a                = $k + 3;
                        $data['DS_' . $a] = $odds[3][$j]; //点数
                    }

                }
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //PC蛋蛋
            case 'PCEGG': //PC蛋蛋 彩种id 11
                header('Content-type:text/json');
                for ($i = 1; $i <= 3; $i++) {
                    $odds[$i] = S($pan . '_odds_11_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 11;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_11_' . $i . '', $odds[$i]);
                    }
                }

                for ($j = 0; $j < 28; $j++) {
                    $a                = $j + 1;
                    $data['HZ_' . $j] = $odds[1][$a]; //和值
                }
                $data['DX_D']    = $odds[2][1];
                $data['DX_X']    = $odds[2][2];
                $data['DS_D']    = $odds[2][3];
                $data['DS_S']    = $odds[2][4];
                $data['JZDX_D']  = $odds[2][5];
                $data['JZDX_X']  = $odds[2][6];
                $data['DXDS_DD'] = $odds[2][7];
                $data['DXDS_XD'] = $odds[2][8];
                $data['DXDS_DS'] = $odds[2][10];
                $data['DXDS_XS'] = $odds[2][9];

                $data['SB_R']   = $odds[3][1];
                $data['SB_G']   = $odds[3][2];
                $data['SB_B']   = $odds[3][3];
                $data['BZ_0']   = $odds[3][4];
                $data['TMB3_0'] = $odds[3][5];
                // print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //北京快8
            case 'BJKL8': //北京快8 彩种id 9
                header('Content-type:text/json');
                for ($i = 1; $i <= 5; $i++) {
                    $odds[$i] = S($pan . '_odds_9_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 9;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_9_' . $i . '', $odds[$i]);
                    }
                }
                if ($count == 7) {
                    //总和、比数、五行
                    $data['ZDX_D']   = $odds[2][1]; //总合大
                    $data['ZDX_X']   = $odds[2][2]; //总合小
                    $data['ZDS_D']   = $odds[2][3]; //总合单
                    $data['ZDS_S']   = $odds[2][4]; //总合双
                    $data['ZHT_810'] = $odds[2][5]; //总合810
                    $data['DXDS_DD'] = $odds[2][6]; //总大单
                    $data['DXDS_DS'] = $odds[2][7]; //总大双
                    $data['DXDS_XD'] = $odds[2][8]; //总小单
                    $data['DXDS_XS'] = $odds[2][9]; //总小双

                    $data['QHH_Q'] = $odds[3][1]; //前(多)
                    $data['QHH_H'] = $odds[3][2]; //後(多)
                    $data['QHH_T'] = $odds[3][3]; //前後(和)

                    $data['DSH_D'] = $odds[4][1]; //单(多)
                    $data['DSH_S'] = $odds[4][2]; //双(多)
                    $data['DSH_T'] = $odds[4][3]; //单双(和)

                    for ($j = 0; $j < 5; $j++) {
                        $a                = $j + 1;
                        $data['WX_' . $j] = $odds[5][$a]; //五行
                    }
                } else if ($count == 1) {
                    // 正码
                    for ($j = 1; $j <= 80; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[1][$j]; //正吗
                        } else {
                            $data['ZM_' . $j] = $odds[1][$j]; //正吗
                        }
                    }

                }

                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //加拿大
            case 'JNDKL8': //加拿大 彩种id 15
                header('Content-type:text/json');
                for ($i = 1; $i <= 5; $i++) {
                    $odds[$i] = S($pan . '_odds_15_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 15;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_15_' . $i . '', $odds[$i]);
                    }
                }
                if ($count == 7) {
                    //总和、比数、五行
                    $data['ZDX_D']   = $odds[2][1]; //总合大
                    $data['ZDX_X']   = $odds[2][2]; //总合小
                    $data['ZDS_D']   = $odds[2][3]; //总合单
                    $data['ZDS_S']   = $odds[2][4]; //总合双
                    $data['ZHT_810'] = $odds[2][5]; //总合810
                    $data['DXDS_DD'] = $odds[2][6]; //总大单
                    $data['DXDS_DS'] = $odds[2][7]; //总大双
                    $data['DXDS_XD'] = $odds[2][8]; //总小单
                    $data['DXDS_XS'] = $odds[2][9]; //总小双

                    $data['QHH_Q'] = $odds[3][1]; //前(多)
                    $data['QHH_H'] = $odds[3][2]; //後(多)
                    $data['QHH_T'] = $odds[3][3]; //前後(和)

                    $data['DSH_D'] = $odds[4][1]; //单(多)
                    $data['DSH_S'] = $odds[4][2]; //双(多)
                    $data['DSH_T'] = $odds[4][3]; //单双(和)

                    for ($j = 0; $j < 5; $j++) {
                        $a                = $j + 1;
                        $data['WX_' . $j] = $odds[5][$a]; //五行
                    }
                } else if ($count == 1) {
                    // 正码
                    for ($j = 1; $j <= 80; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[1][$j]; //正吗
                        } else {
                            $data['ZM_' . $j] = $odds[1][$j]; //正吗
                        }
                    }

                }

                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //台湾宾果
            case 'TWBG': //台湾宾果 彩种id 22
                header('Content-type:text/json');
                for ($i = 1; $i <= 5; $i++) {
                    $odds[$i] = S($pan . '_odds_22_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 22;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_9_' . $i . '', $odds[$i]);
                    }
                }
                if ($count == 7) {
                    //总和、比数、五行
                    $data['ZDX_D']   = $odds[2][1]; //总合大
                    $data['ZDX_X']   = $odds[2][2]; //总合小
                    $data['ZDS_D']   = $odds[2][3]; //总合单
                    $data['ZDS_S']   = $odds[2][4]; //总合双
                    $data['ZHT_810'] = $odds[2][5]; //总合810
                    $data['DXDS_DD'] = $odds[2][6]; //总大单
                    $data['DXDS_DS'] = $odds[2][7]; //总大双
                    $data['DXDS_XD'] = $odds[2][8]; //总小单
                    $data['DXDS_XS'] = $odds[2][9]; //总小双

                    $data['QHH_Q'] = $odds[3][1]; //前(多)
                    $data['QHH_H'] = $odds[3][2]; //後(多)
                    $data['QHH_T'] = $odds[3][3]; //前後(和)

                    $data['DSH_D'] = $odds[4][1]; //单(多)
                    $data['DSH_S'] = $odds[4][2]; //双(多)
                    $data['DSH_T'] = $odds[4][3]; //单双(和)

                    for ($j = 0; $j < 5; $j++) {
                        $a                = $j + 1;
                        $data['WX_' . $j] = $odds[5][$a]; //五行
                    }
                } else if ($count == 1) {
                    // 正码
                    for ($j = 1; $j <= 80; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[1][$j]; //正吗
                        } else {
                            $data['ZM_' . $j] = $odds[1][$j]; //正吗
                        }
                    }

                }

                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //广西快乐十分
            case 'GXKLSF': //广西快乐十分 彩种id 10
                header('Content-type:text/json');
                for ($i = 1; $i <= 6; $i++) {
                    $odds[$i] = S($pan . '_odds_10_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 10;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_10_' . $i . '', $odds[$i]);
                    }
                }

                if ($count == 24) {
                    //两面
                    for ($j = 1; $j <= 5; $j++) {
                        $a                        = $j + 1;
                        $data['YDX' . $j . '_D']  = $odds[$a][29]; //大
                        $data['YDX' . $j . '_X']  = $odds[$a][30]; //小
                        $data['YDS' . $j . '_D']  = $odds[$a][31]; //单
                        $data['YDS' . $j . '_S']  = $odds[$a][32]; //双
                        $data['YWDX' . $j . '_D'] = $odds[$a][33]; //尾大
                        $data['YWDX' . $j . '_X'] = $odds[$a][34]; //尾小
                        $data['YHDS' . $j . '_D'] = $odds[$a][35]; //合单
                        $data['YHDS' . $j . '_S'] = $odds[$a][36]; //合双
                    }
                    $data['ZDS_D']  = $odds[1][1]; //总和单
                    $data['ZDS_S']  = $odds[1][2]; //总和双
                    $data['ZDX_D']  = $odds[1][3]; //总和大
                    $data['ZDX_X']  = $odds[1][4]; //总和小
                    $data['ZWDX_D'] = $odds[1][5]; //总尾大
                    $data['ZWDX_X'] = $odds[1][6]; //总尾小
                    $data['LH15_L'] = $odds[1][7]; //龙
                    $data['LH15_H'] = $odds[1][8]; //虎

                } else if ($count == 5) {
                    // 单号1~5
                    for ($j = 1; $j <= 5; $j++) {
                        $a = $j + 1;
                        for ($k = 1; $k <= 21; $k++) {
                            if ($k < 10) {
                                $data['B' . $j . '_0' . $k] = $odds[$a][$k]; //
                            } else {
                                $data['B' . $j . '_' . $k] = $odds[$a][$k];
                            }
                        }
                    }
                } else if ($count == 7) {
                    // 第N球
                    $a = $_SESSION['index'];
                    $b = $a + 1;
                    for ($j = 1; $j <= 21; $j++) {
                        if ($j < 10) {
                            $data['B' . $a . '_0' . $j] = $odds[$b][$j]; //
                        } else {
                            $data['B' . $a . '_' . $j] = $odds[$b][$j];
                        }
                    }
                    $data['SB' . $a . '_R']    = $odds[$b][22]; //红
                    $data['SB' . $a . '_B']    = $odds[$b][23]; //蓝
                    $data['SB' . $a . '_G']    = $odds[$b][24]; //绿
                    $data['YFLSX' . $a . '_F'] = $odds[$b][25]; //福
                    $data['YFLSX' . $a . '_L'] = $odds[$b][26]; //禄
                    $data['YFLSX' . $a . '_S'] = $odds[$b][27]; //寿
                    $data['YFLSX' . $a . '_X'] = $odds[$b][28]; //喜
                    $data['YDX' . $a . '_D']   = $odds[$b][29]; //大
                    $data['YDX' . $a . '_X']   = $odds[$b][30]; //小
                    $data['YDS' . $a . '_D']   = $odds[$b][31]; //单
                    $data['YDS' . $a . '_S']   = $odds[$b][32]; //双
                    $data['YWDX' . $a . '_D']  = $odds[$b][33]; //尾大
                    $data['YWDX' . $a . '_X']  = $odds[$b][34]; //尾小
                    $data['YHDS' . $a . '_D']  = $odds[$b][35]; //合单
                    $data['YHDS' . $a . '_S']  = $odds[$b][36]; //合双

                }

                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //香港六合彩
            case 'HK6': // 彩种id 12
                header('Content-type:text/json');
                for ($i = 1; $i <= 13; $i++) {
                    if ($i == 1 || $i == 7 || $i == 12) {
                        for ($j = 1; $j <= 8; $j++) {
                            $odds[$i][$j] = S($pan . '_odds_12_' . $i . '_' . $j . '');
                            if (empty($odds[$i][$j])) {
                                $condition['c_id']  = 12;
                                $condition['w_id']  = $i;
                                $condition['cl_id'] = $j;
                                $odd                = M('lottery_odds')->where($condition)->getField('odds');
                                if ($odd) {
                                    $odds[$i][$j] = unserialize($odd);
                                    S($pan . '_odds_12_' . $i . '_' . $j . '', $odds[$i][$j]);
                                }
                            }
                        }
                    } else {
                        $odds[$i] = S($pan . '_odds_12_' . $i . '');
                        if (empty($odds[$i])) {
                            $condition1['c_id'] = 12;
                            $condition1['w_id'] = $i;

                            $odd      = M('lottery_odds')->where($condition1)->getField('odds');
                            $odds[$i] = unserialize($odd);
                            S($pan . '_odds_12_' . $i . '', $odds[$i]);
                        }
                    }

                }

                if ($games == 'TMA,DX,DS,HDS,HDX,WDX,TDXDS,SB') {
                    //特码A
                    for ($j = 1; $j <= 49; $j++) {
                        if ($j < 10) {
                            $data['TMA_0' . $j] = $odds[1][1][$j];
                        } else {
                            $data['TMA_' . $j] = $odds[1][1][$j];
                        }

                    }
                    $data['DX_D']     = $odds[2][1];
                    $data['DX_X']     = $odds[2][2];
                    $data['DS_D']     = $odds[2][3];
                    $data['DS_S']     = $odds[2][4];
                    $data['HDS_D']    = $odds[2][7];
                    $data['HDS_S']    = $odds[2][8];
                    $data['HDX_D']    = $odds[2][5];
                    $data['HDX_X']    = $odds[2][6];
                    $data['WDX_D']    = $odds[2][15];
                    $data['WDX_X']    = $odds[2][16];
                    $data['TDXDS_XD'] = $odds[2][22];
                    $data['TDXDS_XS'] = $odds[2][24];
                    $data['TDXDS_DD'] = $odds[2][21];
                    $data['TDXDS_DS'] = $odds[2][23];

                } else if ($games == 'TMB,DX,DS,HDS,HDX,WDX,TDXDS,SB') {
                    // 特码B
                    for ($j = 1; $j <= 49; $j++) {
                        if ($j < 10) {
                            $data['TMB_0' . $j] = $odds[1][2][$j];
                        } else {
                            $data['TMB_' . $j] = $odds[1][2][$j];
                        }
                    }
                    $data['DX_D']     = $odds[2][1];
                    $data['DX_X']     = $odds[2][2];
                    $data['DS_D']     = $odds[2][3];
                    $data['DS_S']     = $odds[2][4];
                    $data['HDS_D']    = $odds[2][7];
                    $data['HDS_S']    = $odds[2][8];
                    $data['HDX_D']    = $odds[2][5];
                    $data['HDX_X']    = $odds[2][6];
                    $data['WDX_D']    = $odds[2][15];
                    $data['WDX_X']    = $odds[2][16];
                    $data['TDXDS_XD'] = $odds[2][22];
                    $data['TDXDS_XS'] = $odds[2][24];
                    $data['TDXDS_DD'] = $odds[2][21];
                    $data['TDXDS_DS'] = $odds[2][23];
                } elseif ($games == 'DX,DS,HDS,HDX,WDX,TDXDS,QHX,JQYS,TDX,ZDS,ZDX') {
                    //两面
                    $data['DX_D']     = $odds[2][1];
                    $data['DX_X']     = $odds[2][2];
                    $data['DS_D']     = $odds[2][3];
                    $data['DS_S']     = $odds[2][4];
                    $data['HDS_D']    = $odds[2][7];
                    $data['HDS_S']    = $odds[2][8];
                    $data['HDX_D']    = $odds[2][5];
                    $data['HDX_X']    = $odds[2][6];
                    $data['WDX_D']    = $odds[2][15];
                    $data['WDX_X']    = $odds[2][16];
                    $data['TDXDS_XD'] = $odds[2][22];
                    $data['TDXDS_XS'] = $odds[2][24];
                    $data['TDXDS_DD'] = $odds[2][21];
                    $data['TDXDS_DS'] = $odds[2][23];

                    $data['QHX_Q']   = $odds[2][11];
                    $data['QHX_H']   = $odds[2][12];
                    $data['JQYS_JQ'] = $odds[2][13];
                    $data['JQYS_YS'] = $odds[2][14];
                    $data['TDX_T']   = $odds[2][9];
                    $data['TDX_D']   = $odds[2][10];
                    $data['ZDS_D']   = $odds[2][19];
                    $data['ZDS_S']   = $odds[2][20];
                    $data['ZDX_D']   = $odds[2][17];
                    $data['ZDX_X']   = $odds[2][18];

                } elseif ($games == 'SB,BBDS,BBDX,BBB') {
                    //色波
                    $data['SB_R'] = $odds[3][1];
                    $data['SB_B'] = $odds[3][2];
                    $data['SB_G'] = $odds[3][3];

                    $data['BBDS_RD'] = $odds[3][4];
                    $data['BBDS_RS'] = $odds[3][5];
                    $data['BBDX_RD'] = $odds[3][6];
                    $data['BBDX_RX'] = $odds[3][7];
                    $data['BBDS_BD'] = $odds[3][8];
                    $data['BBDS_BS'] = $odds[3][9];
                    $data['BBDX_BD'] = $odds[3][10];
                    $data['BBDX_BX'] = $odds[3][11];
                    $data['BBDS_GD'] = $odds[3][12];
                    $data['BBDS_GS'] = $odds[3][13];
                    $data['BBDX_GD'] = $odds[3][14];
                    $data['BBDX_GX'] = $odds[3][15];

                    $data['BBB_RDD'] = $odds[3][16];
                    $data['BBB_RDS'] = $odds[3][17];
                    $data['BBB_RXD'] = $odds[3][18];
                    $data['BBB_RXS'] = $odds[3][19];

                    $data['BBB_BDD'] = $odds[3][20];
                    $data['BBB_BDS'] = $odds[3][21];
                    $data['BBB_BXD'] = $odds[3][22];
                    $data['BBB_BXS'] = $odds[3][23];
                    $data['BBB_GDD'] = $odds[3][24];
                    $data['BBB_GDS'] = $odds[3][25];
                    $data['BBB_GXD'] = $odds[3][26];
                    $data['BBB_GXS'] = $odds[3][27];

                } elseif ($games == 'SX,TMTS,TMWS') {
                    for ($j = 0; $j < 12; $j++) {
                        $a                = $j + 1;
                        $data['SX_' . $j] = $odds[4][$a];
                        if ($j < 5) {
                            $b                  = $j + 13;
                            $data['TMTS_' . $j] = $odds[4][$b];
                        }
                        if ($j < 10) {
                            if ($j == 0) {
                                $c = 27;
                            } else {
                                $c = $j + 17;
                            }
                            $data['TMWS_' . $j] = $odds[4][$c];
                        }
                    }
                } elseif ($games == 'HX') {
                    for ($j = 1; $j <= 10; $j++) {
                        $a                = $j + 1;
                        $data['HX_' . $a] = $odds[5][$j];
                    }
                } elseif ($games == 'ZM,ZDS,ZDX') {
                    for ($j = 1; $j <= 49; $j++) {
                        if ($j < 10) {
                            $data['ZM_0' . $j] = $odds[6][$j];
                        } else {
                            $data['ZM_' . $j] = $odds[6][$j];
                        }
                    }
                    $data['ZDS_D'] = $odds[6][52];
                    $data['ZDS_S'] = $odds[6][53];
                    $data['ZDX_D'] = $odds[6][50];
                    $data['ZDX_X'] = $odds[6][51];
                } elseif ($games == 'ZMT1,DX,DS,HDS,ZMDS1,ZMDX1,ZHDS1,ZMSB1' || $games == 'ZMT2,DX,DS,HDS,ZMDS2,ZMDX2,ZHDS2,ZMSB2' || $games == 'ZMT3,DX,DS,HDS,ZMDS3,ZMDX3,ZHDS3,ZMSB3' || $games == 'ZMT4,DX,DS,HDS,ZMDS4,ZMDX4,ZHDS4,ZMSB4' || $games == 'ZMT5,DX,DS,HDS,ZMDS5,ZMDX5,ZHDS5,ZMSB5' || $games == 'ZMT6,DX,DS,HDS,ZMDS6,ZMDX6,ZHDS6,ZMSB6') {
                    $a = $_SESSION['index'];
                    for ($j = 1; $j <= 49; $j++) {
                        if ($j < 10) {
                            $data['ZMT' . $a . '_0' . $j] = $odds[7][$a][$j];
                        } else {
                            $data['ZMT' . $a . '_' . $j] = $odds[7][$a][$j];
                        }

                    }
                    $data['ZMDX' . $a . '_D'] = $odds[7][$a][50];
                    $data['ZMDX' . $a . '_X'] = $odds[7][$a][51];
                    $data['ZMDS' . $a . '_D'] = $odds[7][$a][52];
                    $data['ZMDS' . $a . '_S'] = $odds[7][$a][53];
                    $data['ZHDS' . $a . '_D'] = $odds[7][$a][54];
                    $data['ZHDS' . $a . '_S'] = $odds[7][$a][55];
                    $data['ZMSB' . $a . '_R'] = $odds[7][$a][60];
                    $data['ZMSB' . $a . '_B'] = $odds[7][$a][62];
                    $data['ZMSB' . $a . '_G'] = $odds[7][$a][61];
                } elseif ($count == 36) {
                    for ($a = 1; $a <= 6; $a++) {
                        $data['ZMDX' . $a . '_D']  = $odds[7][$a][50];
                        $data['ZMDX' . $a . '_X']  = $odds[7][$a][51];
                        $data['ZMDS' . $a . '_D']  = $odds[7][$a][52];
                        $data['ZMDS' . $a . '_S']  = $odds[7][$a][53];
                        $data['ZHDS' . $a . '_D']  = $odds[7][$a][54];
                        $data['ZHDS' . $a . '_S']  = $odds[7][$a][55];
                        $data['ZHDX' . $a . '_D']  = $odds[7][$a][56];
                        $data['ZHDX' . $a . '_X']  = $odds[7][$a][57];
                        $data['ZMWDX' . $a . '_D'] = $odds[7][$a][58];
                        $data['ZMWDX' . $a . '_X'] = $odds[7][$a][59];
                        $data['ZMSB' . $a . '_R']  = $odds[7][$a][60];
                        $data['ZMSB' . $a . '_B']  = $odds[7][$a][62];
                        $data['ZMSB' . $a . '_G']  = $odds[7][$a][61];
                    }
                } elseif ($games == 'WX') {
                    for ($a = 0; $a <= 4; $a++) {
                        $b                = $a + 1;
                        $data['WX_' . $a] = $odds[8][$b];
                    }
                } elseif ($games == 'YX,WS,ZSX,ZSXDS') {
                    for ($a = 0; $a <= 11; $a++) {
                        $b                = $a + 1;
                        $data['YX_' . $a] = $odds[9][$b];
                        if ($a < 10) {
                            $c                = $a + 13;
                            $data['WS_' . $a] = $odds[9][$c];
                        }
                        if ($a < 7) {
                            $d                 = $a + 2;
                            $e                 = $a + 23;
                            $data['ZSX_' . $d] = $odds[9][$e];
                        }

                    }
                    $data['ZSXDS_D'] = $odds[9][29];
                    $data['ZSXDS_S'] = $odds[9][30];
                } elseif ($games == 'ZX,7SB') {
                    for ($a = 0; $a <= 11; $a++) {
                        $b                = $a + 1;
                        $data['ZX_' . $a] = $odds[10][$b];
                    }
                    $data['7SB_R']   = $odds[10][13];
                    $data['7SB_B']   = $odds[10][14];
                    $data['7SB_G']   = $odds[10][15];
                    $data['7SB_TIE'] = $odds[10][16];
                } elseif ($games == 'ZXBZ') {
                    for ($a = 1; $a <= 7; $a++) {
                        $b                  = $a + 4;
                        $data['ZXBZ_' . $b] = $odds[11][$a];
                    }
                } elseif ($games == 'LX2' || $games == 'LX3' || $games == 'LX4' || $games == 'LX5') {
                    $a = $_SESSION['index'];
                    $b = $a - 1;
                    for ($j = 0; $j <= 11; $j++) {
                        $c                          = $j + 1;
                        $data['LX' . $a . '_' . $j] = $odds[12][$b][$c];
                    }
                } elseif ($games == 'LW2' || $games == 'LW3' || $games == 'LW4' || $games == 'LW5') {
                    $a = $_SESSION['index'];
                    $b = $a + 3;
                    for ($j = 0; $j <= 9; $j++) {
                        $c                          = $j + 1;
                        $data['LW' . $a . '_' . $j] = $odds[12][$b][$c];
                    }
                } elseif ($games == 'LM3Z2,LM3Z2_0,LM3QZ,LM2QZ,LM2ZT,LMTC,LM4QZ,LM31,LM32') {
                    $data['LM3Z2_0']   = $odds[13][1];
                    $data['LM3Z2_0_1'] = $odds[13][2];
                    $data['LM3QZ_0']   = $odds[13][3];
                    $data['LM2QZ_0']   = $odds[13][4];
                    $data['LM2ZT_0']   = $odds[13][5];
                    $data['LM2ZT_0_1'] = $odds[13][6];
                    $data['LMTC_0']    = $odds[13][7];
                    $data['LM4QZ_0']   = $odds[13][8];
                } elseif ($games == 'ZSX,ZSXDS') {
                    for ($a = 0; $a <= 11; $a++) {

                        if ($a < 7) {
                            $d                 = $a + 2;
                            $e                 = $a + 23;
                            $data['ZSX_' . $d] = $odds[9][$e];
                        }

                    }
                    $data['ZSXDS_D'] = $odds[9][29];
                    $data['ZSXDS_S'] = $odds[9][30];
                }

                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //分分彩
            case 'FFC': //分分彩 彩种id 13
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_13_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 13;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_13_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //QQ分分彩
            case 'QQFFC': //QQ分分彩 彩种id 16
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_16_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 16;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_16_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            //QQ分分彩
            case 'TXFFC': //QQ分分彩 彩种id 17
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_17_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 17;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_17_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;

            case 'SHSSL': //上海时时乐 彩种id 21
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_21_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 21;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_21_' . $i . '', $odds[$i]);
                    }
                }
                if ($count = 23) {
                    for ($j = 0; $j <= 9; $j++) {

                        $data['1Z_' . $j] = $odds[1][$j]; //1-10球 的赔率

                    }
                    for ($j = 1; $j <= 3; $j++) {
                        $jj                      = $j * 10;
                        $data['DX' . $j . '_D']  = $odds[1][$jj + 1];
                        $data['DX' . $j . '_X']  = $odds[1][$jj + 2];
                        $data['DS' . $j . '_D']  = $odds[1][$jj + 3];
                        $data['DS' . $j . '_S']  = $odds[1][$jj + 4];
                        $data['ZIH' . $j . '_Z'] = $odds[1][$jj + 5];
                        $data['ZIH' . $j . '_H'] = $odds[1][$jj + 6];
                    }

                }
                if ($games == '1Z') {
                    for ($j = 0; $j <= 9; $j++) {

                        $data['1Z_' . $j] = $odds[1][$j]; //1-10球 的赔率

                    }
                    for ($j = 1; $j <= 3; $j++) {
                        $jj                      = $j * 10;
                        $data['DX' . $j . '_D']  = $odds[1][$jj + 1];
                        $data['DX' . $j . '_X']  = $odds[1][$jj + 2];
                        $data['DS' . $j . '_D']  = $odds[1][$jj + 3];
                        $data['DS' . $j . '_S']  = $odds[1][$jj + 4];
                        $data['ZIH' . $j . '_Z'] = $odds[1][$jj + 5];
                        $data['ZIH' . $j . '_H'] = $odds[1][$jj + 6];
                    }

                }
                if ($games == '2Z') {
                    for ($j = 0; $j <= 99; $j++) {
                        if ($j < 10) {
                            $jj                = '0' . $j;
                            $data['2Z_' . $jj] = $odds[2][$j];
                        } else {
                            $data['2Z_' . $j] = $odds[2][$j];
                        }

                    }
                }
                if ($games == '3Z') {
                    for ($j = 0; $j <= 999; $j++) {
                        if ($j < 10) {
                            $jj                = '00' . $j;
                            $data['3Z_' . $jj] = $odds[3][$j];
                        } elseif ($j >= 10 && $j < 100) {
                            $jj                = '0' . $j;
                            $data['3Z_' . $jj] = $odds[3][$j];
                        } else {
                            $data['3Z_' . $j] = $odds[3][$j];
                        }

                    }
                }
                if ($games == 'DW1,DW2,DW3') {
                    for ($j = 0; $j <= 9; $j++) {
                        $jj                = $j + 10;
                        $data['DW1_' . $j] = $odds[4][$jj];
                    }
                    for ($j = 0; $j <= 9; $j++) {
                        $jj                = $j + 10;
                        $data['DW2_' . $j] = $odds[4][$jj];
                    }
                    for ($j = 0; $j <= 9; $j++) {
                        $jj                = $j + 10;
                        $data['DW3_' . $j] = $odds[4][$jj];
                    }

                }
                if ($games == 'HS12,HWS12') {

                    for ($j = 0; $j <= 9; $j++) {

                        $data['HWS12_' . $j] = $odds[5][$j];
                    }
                    for ($j = 4; $j <= 14; $j++) {
                        $jj                 = $j + 10;
                        $data['HS12_' . $j] = $odds[5][$jj];
                    }

                }
                if ($games == 'HS13,HWS13') {

                    for ($j = 0; $j <= 9; $j++) {

                        $data['HWS13_' . $j] = $odds[6][$j];
                    }
                    for ($j = 4; $j <= 14; $j++) {
                        $jj                 = $j + 10;
                        $data['HS13_' . $j] = $odds[6][$jj];
                    }

                }
                if ($games == 'HS23,HWS23') {

                    for ($j = 0; $j <= 9; $j++) {

                        $data['HWS23_' . $j] = $odds[7][$j];
                    }
                    for ($j = 4; $j <= 14; $j++) {
                        $jj                 = $j + 10;
                        $data['HS23_' . $j] = $odds[7][$jj];
                    }

                }
                if ($games == 'HS,HWS123') {

                    for ($j = 0; $j <= 9; $j++) {

                        $data['HWS123_' . $j] = $odds[8][$j];
                    }
                    for ($j = 6; $j <= 22; $j++) {
                        $jj               = $j + 9;
                        $data['HS_' . $j] = $odds[8][$jj];
                    }

                }

                $data['DW12_0'] = $odds[4][121];
                $data['DW13_0'] = $odds[4][131];
                $data['DW23_0'] = $odds[4][231];
                $data['3DW_0']  = $odds[4][123];

                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;

            //台湾五分
            case 'TWWF': //台湾五分 彩种id 23
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_23_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 23;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_23_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;

            case 'JND': //加拿大3.5 彩种id 24
                header('Content-type:text/json');
                for ($i = 1; $i <= 9; $i++) {
                    $odds[$i] = S($pan . '_odds_24_' . $i . '');
                    if (empty($odds[$i])) {
                        $condition['c_id'] = 24;
                        $condition['w_id'] = $i;
                        $odd               = M('lottery_odds')->where($condition)->getField('odds');
                        $odds[$i]          = unserialize($odd);
                        S($pan . '_odds_24_' . $i . '', $odds[$i]);
                    }
                }
                // print_r($odds);exit;
                if ($count == 21) {
                    //整合

                    for ($a = 1; $a <= 5; $a++) {

                        $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                        $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                        $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                        $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                        for ($j = 0; $j <= 9; $j++) {
                            $b                         = $j + 5;
                            $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率
                        }

                        if ($a <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $a + 6;
                                $e                          = $c + 1;
                                $data['TS' . $a . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }
                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                } else if ($count == 9) {
                    //1-5号球
                    $a                      = $_SESSION['index'];
                    $data['DX' . $a . '_D'] = $odds[$a][1]; //1-10名 大的赔率
                    $data['DX' . $a . '_X'] = $odds[$a][2]; //1-10名 小的赔率

                    $data['DS' . $a . '_D'] = $odds[$a][3]; //1-10名 单的赔率
                    $data['DS' . $a . '_S'] = $odds[$a][4]; //1-10名 双的赔率
                    for ($j = 0; $j <= 9; $j++) {
                        $b                         = $j + 5;
                        $data['B' . $a . '_' . $j] = $odds[$a][$b]; //1-10球 的赔率

                        if ($j <= 3) {
                            for ($c = 0; $c <= 4; $c++) {
                                $d                          = $j + 6;
                                $e                          = $c + 1;
                                $data['TS' . $j . '_' . $c] = $odds[$d][$e]; //前三 中三 后三 的赔率
                            }

                        }

                    }

                    $data['ZDS_D'] = $odds[6][3];
                    $data['ZDS_S'] = $odds[6][4];
                    $data['ZDX_D'] = $odds[6][1];
                    $data['ZDX_X'] = $odds[6][2];
                    $data['LH_L']  = $odds[6][5];
                    $data['LH_H']  = $odds[6][6];
                    $data['LH_T']  = $odds[6][7];

                }
                //  print_r($data);exit;
                S('odds_' . $c_type, $data);
                echo json_encode($data);exit(0);
                break;
            default:$this->display();
                break;

        }

        echo json_encode($data);exit(0);
    }

}
